import type { TreeNode, TreeNodeData } from 'element-plus/es/components/tree-v2/src/types';
import type { PropType } from 'vue-types/dist/types';

export const treeProps = {
  /**
   * 来源
   * list列表 urban城建档案归档目录
   */
  source: {
    type: String as PropType<'list' | 'urban'>,
    default: 'list',
  },
  /**
   * 二级状态 1 正常  2查询全部 3归档单位查询
   */
  letTopTwoState: {
    type: Number as PropType<1 | 2 | 3>,
    default: 1,
  },
  /**
   * tree高度
   */
  treeHegith: {
    type: Number,
    default: 0,
  },
  /**
   * 数据
   */
  data: {
    type: Array as PropType<TreeNode[]>,
    default: [],
  },
  props: {
    type: Object,
    default: {
      value: 'key',
      label: 'title',
      children: 'children',
      class: ({ key }: TreeNodeData, _node: Node) => {
        const isOne = key.indexOf('-');
        return isOne == -1 ? 'tree-first-data' : '';
      },
    },
  },
  //是否高亮当前选中节点
  highlightCurrent: {
    type: Boolean,
    default: true,
  },
  //是否在点击节点的时候展开或者收缩节点
  expandOnClickNode: {
    type: Boolean,
    default: false,
  },
  checkOnClickNode: {
    type: Boolean,
    default: false,
  },
};
